package org.yelongframework.excel.data.fill.sheet.mode.simple;

import org.yelongframework.excel.data.fill.sheet.SheetDataFillDataSupplier;
import org.yelongframework.excel.data.fill.sheet.SheetDataFillException;
import org.yelongframework.lang.Nullable;

/**
 * 简单的数据供应商
 * 
 * @since 1.0.0
 */
@FunctionalInterface
public interface SimpleSheetDataFillDataSupplier extends SheetDataFillDataSupplier {

	/**
	 * 获取数据值
	 * 
	 * @return 数据值
	 * @throws Exception 数据提供异常
	 */
	@Nullable
	Object get() throws Exception;

	/**
	 * 获取数据值。包装异常
	 * 
	 * @return 数据值
	 * @throws SheetDataFillException 数据提供异常
	 */
	@Nullable
	default Object get0() throws SheetDataFillException {
		try {
			return get();
		} catch (Exception e) {
			throw new SheetDataFillException("数据获取异常", e);
		}
	}

}
